package controller

import (
	"blog/dao"
	"fmt"
	"github.com/julienschmidt/httprouter"
	"html/template"
	"net/http"
)

/**
关于
*/
func AboutHandle(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
	dao.CommonAction(r, w)
	t, err := template.New("about.html").Funcs(dao.FuncMap).ParseFiles("templates/about.html", "templates/pub_inc.html")
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}

	type Data struct {
		Abouts   dao.Opts
		PageName string
	}
	var D Data
	D.PageName = "关于"
	D.Abouts, err = D.Abouts.GetAllAbout()
	if err != nil {
		fmt.Println(err)
	}

	t.Execute(w, D)
}
